Есть желание использовать современные языковые фитчи, но переписывать код в ручную долго и скучно, тогда можно воспользоваться помощью искусственного интеллекта😄
Для того чтобы сделать свой код более современным используй следующий промпт:
Refactor the following code to modern [Тут напиши стандарт] programming standards:
[Сюда вставь свой код]
❗️Пример использования промпта:
Refactor the following code to modern c++23 programming standards:
int* createIntArray(int size) { int* arr = new int[size]; for (int i = 0; i < size; ++i) { arr[i] = i * i; } return arr; }
// Option 1: Return a std::vector (recommended for most cases) auto createIntArray(int size) -> std::vector<int> { std::vector<int> arr(size); std::ranges::generate(arr, [i = 0]() mutable { return i * i++; }); return arr; }
// Option 2: Return a std::unique_ptr (if you specifically need heap allocation) auto createIntArrayUnique(int size) -> std::unique_ptr<int[]> { auto arr = std::make_unique<int[]>(size); for (int i = 0; i < size; ++i) { arr[i] = i * i; } return arr; }
Это достаточно простой и быстрый способ привести код к текущему стандарту. К сожалению результат работы промпта всё де придётся проверить, так как текущая реализация AI далека от идеала, но даже так времени можно сэкономить массу.
👀 А как ты приводишь свой код к более современному виду? Делитесь в комментариях!
Есть желание использовать современные языковые фитчи, но переписывать код в ручную долго и скучно, тогда можно воспользоваться помощью искусственного интеллекта😄
Для того чтобы сделать свой код более современным используй следующий промпт:
Refactor the following code to modern [Тут напиши стандарт] programming standards:
[Сюда вставь свой код]
❗️Пример использования промпта:
Refactor the following code to modern c++23 programming standards:
int* createIntArray(int size) { int* arr = new int[size]; for (int i = 0; i < size; ++i) { arr[i] = i * i; } return arr; }
// Option 1: Return a std::vector (recommended for most cases) auto createIntArray(int size) -> std::vector<int> { std::vector<int> arr(size); std::ranges::generate(arr, [i = 0]() mutable { return i * i++; }); return arr; }
// Option 2: Return a std::unique_ptr (if you specifically need heap allocation) auto createIntArrayUnique(int size) -> std::unique_ptr<int[]> { auto arr = std::make_unique<int[]>(size); for (int i = 0; i < size; ++i) { arr[i] = i * i; } return arr; }
Это достаточно простой и быстрый способ привести код к текущему стандарту. К сожалению результат работы промпта всё де придётся проверить, так как текущая реализация AI далека от идеала, но даже так времени можно сэкономить массу.
👀 А как ты приводишь свой код к более современному виду? Делитесь в комментариях!
Durov said on his Telegram channel today that the two and a half year blockchain and crypto project has been put to sleep. Ironically, after leaving Russia because the government wanted his encryption keys to his social media firm, Durov’s cryptocurrency idea lost steam because of a U.S. court. “The technology we created allowed for an open, free, decentralized exchange of value and ideas. TON had the potential to revolutionize how people store and transfer funds and information,” he wrote on his channel. “Unfortunately, a U.S. court stopped TON from happening.”
Telegram hopes to raise $1bn with a convertible bond private placement
The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.
Библиотека C C разработчика | cpp boost qt from ca